import { Nodes } from '@knno/dom';
import { Roller as UIRoller } from '../components/roller/roller';
import { JSXProps } from '@knno/dom/jsx';
import { AttrCheck, isArray, isStr, jsxBuild } from './utils';

export { UIRoller };

interface RollerProps extends JSXProps<UIRoller> {
	options?: string[];
	value?: string;
}

const ATTRS: AttrCheck = {
	options: isArray,
	value: isStr,
};

export function Roller(props: RollerProps, children: Nodes[]): UIRoller {
	return jsxBuild(new UIRoller(), props, children, ATTRS);
}
